﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace AMS.DataAccess.Dao
{
    /// <summary>
    /// 一个简单的 SQL 适配器的抽象
    /// </summary>
    public interface ISqlAdapter
    {
        /// <summary>
        /// 执行SQL语句
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        int ExecuteSql(string sql);

        /// <summary>
        /// 执行SQL语句
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        int ExecuteSql(string sql, IDataParameter[] parameters);

        /// <summary>
        /// 在一个事务中执行SQL语句
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        int ExecuteSqlTrans(string sql);

        /// <summary>
        /// 在一个事务中执行SQL语句
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        int ExecuteSqlTrans(string sql, IDataParameter[] parameters);

        /// <summary>
        /// 数据查询
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        DataSet Query(string sql);

        /// <summary>
        /// 数据查询
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        DataSet Query(string sql, IDataParameter[] parameters);
    }
}
